package com.googlecode.cswish.oosearch;

import java.util.Map;

/**
 * A class to store the QL structure
 * 
 * @author Jerry.Feng
 *
 */
public class QLClause {

	private String fromClause;
	
	private String whereClause;
	
	/**
	 * table name <--> alias name
	 */
	private Map<String, String> fromTables;

	public QLClause(String fromClause, String whereClause,
			Map<String, String> fromTables) {
		super();
		this.fromClause = fromClause;
		this.whereClause = whereClause;
		this.fromTables = fromTables;
	}

	public String getFromClause() {
		return fromClause;
	}

	public void setFromClause(String fromClause) {
		this.fromClause = fromClause;
	}

	public String getWhereClause() {
		return whereClause;
	}

	public void setWhereClause(String whereClause) {
		this.whereClause = whereClause;
	}

	public Map<String, String> getFromTables() {
		return fromTables;
	}

	public void setFromTables(Map<String, String> fromTables) {
		this.fromTables = fromTables;
	}
	
	// TODO: merge the code with QLParse.nextTableAlias?
	public String nextTableAlias() {
		return QLParse.nextTableAlias(fromTables.values());
    }
}
